package chart.图的存储;

import java.util.List;

/**
 * @author yezh
 * @date 2023/7/10 15:50
 */
public abstract class AbstractGraph {

    /**
     * 顶点数
     */
    protected final int v;
    /**
     * true - 有向图 or false - 无向图
     */
    protected boolean directed;

    public AbstractGraph(int n, boolean directed) {
        this.v = n;
        this.directed = directed;
    }

    public abstract void createGraph(List<Edge> edges);

    public abstract List<Integer> getNeighborVertex(int vertex);

    public abstract List<Edge> getNeighborEdge(int vertex);

    public abstract List<Edge> allEdge();

    public Edge[] getAllEdge() {
        List<Edge> edges = allEdge();
        return edges.toArray(new Edge[0]);
    }

    public abstract void print();

    public int getV() {
        return this.v;
    }

}
